package com.zxn.xmtextdemo;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

import com.zxn.xm.text.FadeInTextView;

public class FadeInTextActivity extends AppCompatActivity {

    public static void jumpTo(Context context) {
        Intent intent = new Intent(context, FadeInTextActivity.class);
        context.startActivity(intent);
    }

    protected FadeInTextView tvXmText;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        super.setContentView(R.layout.activity_main);
        initView();

    }

    private void initView() {
        tvXmText = findViewById(R.id.tv_xm_text);
        String context = getString(R.string.text_xm_msg);
        tvXmText.setTextString(context)
                .startFadeInAnimation()
                .setDuration(150)
                .setTextAnimationListener(() -> {
                    //文字动画结束监听
                    Toast.makeText(this, "结束", Toast.LENGTH_SHORT).show();
                });
    }
}
